#include "Command.h"

ConcreteCommand::ConcreteCommand(Receiver *r)
{
    recver_ = r;
}

ConcreteCommand::~ConcreteCommand()
{
    if (recver_)
    {
        delete recver_;
    }
}

void ConcreteCommand::execute()
{
    recver_->action();
}

void Invoker::set(Command *c)
{
    cmder_ = c;
}

void Invoker::confirm()
{
    if (cmder_)
    {
        cmder_->execute();
    }
}